import { pageQueryFeedback, logicBatchDeleteFeedbackByIds, logicDeleteFeedbackById } from '@/api/admin/common'

const state = {
    feedbackRespData: [],
    total: 0,
};
const mutations = {

    // 分页查询建议反馈信息
    pageQueryFeedbackMutations(state, param) {
        state.feedbackRespData = param.data;
        state.total = param.total;
    },
};
const actions = {
    // 分页查询建议反馈信息
    async pageQueryFeedbackListActions(context, page) {
        await pageQueryFeedback(page).then(resp => {
            if (!resp) return;
            console.log("feedback-->", resp.data);
            context.commit('pageQueryFeedbackMutations', resp.data)
        }, error => {
            console.log(error);
        })
    },

    // 逻辑删除资讯信息
    async logicDeleteFeedbackByIdActions(context, id) {
        await logicDeleteFeedbackById(id).then(resp => {
            if (!resp) return;
            console.log(resp);
        }, error => {
            console.log(error);
        })
    },

    // 批量逻辑删除资讯信息
    async logicBatchDeleteFeedbackByIdsActions(context, ids) {
        await logicBatchDeleteFeedbackByIds(ids).then(resp => {
            if (!resp) return;
            console.log(resp);
        }, error => {
            console.log(error);
        })
    },
};

export default {
    namespaced: true,
    state,
    mutations,
    actions,
}